import request from '@/utils/request'

// 能耗组织机构树每层级
export const getEnergyTreeApi = (orgNo) =>
  request.get(`/ecm-microservice-biz/ecm/factory/energy/organization?orgNo=${orgNo}`)

// 查询设备运行分析报告分页信息
export const getReportPageApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/report/page', { params })

// 新增设备运行分析报告
export const addReportApi = (data) =>
  request.post('/ecm-microservice-biz/ecm/device/operation/analysis/report/add', data)

// 删除设备运行分析报告
export const delReportApi = (id) =>
  request.post(`/ecm-microservice-biz/ecm/device/operation/analysis/report/delete?id=${id}`)

// 查看某个设备运行报告
export const getReportDataApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/report/view', { params })

// 设备用能图(当月/当年)

export const getPipe1DataApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/rate/pipe1', { params })

// 设备用能图(上月/去年)

export const getPipe2DataApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/rate/pipe2', { params })

// 设备利用率

export const getBarDataApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/load/list', { params })

// 设备运行时间表格

export const getRunningAListApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/running/list', { params })

// 设备异常信息

export const getExceptionListApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/device/exception', { params })

// 设备维保图

export const getLedgerListApi = (params) =>
  request.get('/ecm-microservice-biz/ecm/device/operation/analysis/ledger', { params })

// 生成PDF

export const addPDFReportApi = (data) =>
  request.post('/ecm-microservice-biz/ecm/device/operation/analysis/report/createPdf', data)

// 下载PDF

export const downloadPDFReportApi = (data) =>
  request.post('/ecm-microservice-biz/ecm/device/operation/analysis/download/pdf', { data })
